package org.unisinos.gc.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.unisinos.gc.vo.Area;

public class AreaForm extends ActionForm {

	private static final long serialVersionUID = -6923883404179643493L;
	private String codigo;
	private String nome;
	public String getCodigo() {
		return codigo;
	}
	public void setCodigo(String codigo) {
		this.codigo = codigo;
	}
	public String getNome() {
		return nome;
	}
	public void setNome(String nome) {
		this.nome = nome;
	}
	public AreaForm(String codigo, String nome) {
		super();
		this.codigo = codigo;
		this.nome = nome;
	}
	public AreaForm() {
		super();
	}
	public void parseArea(Area area) {
		this.codigo = String.valueOf(area.getCodigo());
		this.nome = area.getNome();
	}
	
	public Area toArea() {
		return new Area(0, nome);
	}
	@Override
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		super.reset(mapping, request);
		this.codigo = "";
		this.nome = "";
	}
	
}